<?php
namespace PsiFramework\Applications\AlloMediaUser\Classes\Actions;

import("Applications.AlloMediaUser.Classes.Actions.ShopAction");
import("Classes.Util.HTTP.AuthenticationManager");
import("Classes.Factory.DAOFactory");
import("Plugins.Shop.Classes.Model.Order");

use \PsiFramework\Applications\AlloMediaUser\Classes\Actions\ShopAction;
use \PsiFramework\Classes\Util\HTTP\AuthenticationManager;
use \PsiFramework\Classes\Util\Parameters\Action\ActionParameters;
use \PsiFramework\Classes\Factory\DAOFactory;
use \PsiFramework\Plugins\Shop\Classes\Model\Order;
use \PsiFramework\Classes\Util\UI\ModuleManager;
use \PsiFramework\Classes\Util\UI\TemplateManager;

/**
 * PsiFramework
 * Php Simple Framework
 *
 * @author Rémi San
 * @version beta
 */

/**
 * Classe d'action de l'index
 *
 * @package Actions.Pages
 */
class ShowThemeAction extends ShopAction
{

    public function __construct(ActionParameters $actionParameters)
    {
        parent::__construct($actionParameters);
    }

    /**
     * The main function of the method which is called every time
     * an action is created by the front controller.
     *
     */
    public function execute()
    {
        parent::execute();
        
        $formId = $this->_request->getParameter('form_id');
        $form = null ;
        
        if (!isNullOrEmptyString($formId)) {
        	$formDao = DAOFactory::getDAO('Form');
        	$form = $formDao->retrieveByPk($formId);
        }
        
        $this->_response->setAttribute("form", $form);
        
        ModuleManager::getInstance()->addModule('LeftMenu', $this->_response);
        //ModuleManager::getInstance()->addModule('Trace', $this->_response);
        
        TemplateManager::getInstance()->addFileScript(
    		'Applications/DefaultApp/Template/scripts/jquery.nivo.slider.js'
        );
        TemplateManager::getInstance()->addFileScript(
    		'Applications/DefaultApp/Template/scripts/jquery.nivo.slider.pack.js'
        );
        
        TemplateManager::getInstance()->addRemoteStyle(
    		'./Styles/default/default.css'
        );
        TemplateManager::getInstance()->addFileStyle(
            'Applications/DefaultApp/Template/styles/nivo-slider.css'
        );
        
        TemplateManager::getInstance()->addLitteralScript(
    		"
    		$(document).ready(function(){
        		$('#slider').nivoSlider();
            });"
        );
        
        $this->findForward('success');
    }
}
